<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ include file="../include/admincontent.jsp" %>
<link rel="stylesheet" href="/resources/js/plugins/kindeditor-4.1.10/themes/default/default.css"/>
<div id="location">当前位置：首页 > 内容管理 > 文章管理 > 修改文章</div>
<div id="Content">
    <form id="Validform" method="post" action="/CMS/EditAction">
        <input type="hidden" name="id" id="id" value="${content.id}" datatype="*" nullmsg="非法访问"/>
<%--        <div class="btnbar">
            <button type="submit" class="save">保存文章</button>
            <button type="button" class="back" onclick="javascript:history.go(-1);">返回</button>
        </div>--%>
        <div class="toolbars">
            <a id="save">
                <em id="add_em" class="ico16 save_traft_16"></em>
                <span id="send_span" class="menu_span" title="保存文章">保存文章</span>
            </a>
            <a onclick="self.location = document.referrer;">
                <em  class="ico16 cancle_publish_16"></em>
                <span  class="menu_span" title="返回">返回</span>
            </a>
        </div>
        <table class="conttable">
            <tbody>
            <tr>
                <td width="80" style="text-align:center;">所属栏目:</td>
                <td style="padding:10px 5px;">
                    <div><select name="nodeid" id="nodeid" datatype="*" nullmsg="所属栏目不能为空">${nodes}</select><input type="hidden"
                                                                                                       value="${content.nodeid}"/>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">文章标题:</td>
                <td style="padding:10px 5px;">
                    <div><input type="text" name="title" id="title" value="${content.title}" datatype="*" nullmsg="文章标题不能为空"/>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">文章内容:</td>
                <td style="padding:10px 5px;">
                    <div class="htmleditor">
                        <textarea id="myEditor" name="conts" datatype="*" nullmsg="文章内容不能为空！"
                                  style="width:100%;height:260px;">${continfo}</textarea>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">添加时间:</td>
                <td style="padding:10px 5px;">
                    <div><input type="text" name="addtime" id="addtime" class="select"
                                value="<fmt:formatDate value="${content.addtime}" pattern="yyyy-MM-dd HH:mm:ss" />"
                                datatype="*" nullmsg="添加时间不能为空" onFocus="blur()"
                                onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm:ss'})"/></div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">招聘方式:</td>
                <td style="padding:10px 5px;">
                    <div>
                        <select name="cmstype" id="cmstype">
                            <option value="高校校园招聘">高校校园招聘</option>
                            <option value="中专校园招聘">中专校园招聘</option>
                            <option value="社会招聘">社会招聘</option>
                            <option value="内部招聘">内部招聘</option>
                        </select>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="text-align:center;">是否下线:</td>
                <td style="padding:10px 5px;">
                    <div><select name="isdis" id="isdis">
                        <option value="已保存">已保存</option>
                        <option value="已下线">已下线</option>
                    </select><input type="hidden" value="${content.isdis}"/></div>
                </td>
            </tr>
            </tbody>
        </table>
    </form>
</div>

<script charset="utf-8" src="/resources/js/plugins/kindeditor-4.1.10/kindeditor-min.js"></script>
<script charset="utf-8" src="/resources/js/plugins/kindeditor-4.1.10/lang/zh_CN.js"></script>
<script type="text/javascript">

    //实例化编辑器
    KindEditor.ready(function (K) {
        K.create('#myEditor', {
            resizeType: 1,
            items: ['source', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'fontsize', 'forecolor', 'bold', 'removeformat', 'fullscreen'],
            afterBlur: function () {
                this.sync();
            }
        });
    });

    $(function () {
        $('select').each(function () {
            $(this).val($(this).next().val());
        });
    });

    $(function () {
        $("#save").on('click',function () {
            var id = $("#id").val();
            var nodeid = $("#nodeid").val();
            var title = $("#title").val();
            var conts = $("#myEditor").val();
            var addtime = $("#addtime").val();
            var cmstype = $("#cmstype").val();
            var isdis = $("#isdis").val();

            $.ajax({
                url:"/CMS/EditAction",
                type:'POST',
                data:{"id":id,"nodeid":nodeid,"title":title,"conts":conts,"addtime":addtime,"cmstype":cmstype,"isdis":isdis},
                success:function (data) {
                    layer.msg(data.Message,{icon:1});
                    self.location = document.referrer;
                },
                error:function (data) {
                    layer.msg(data.Message,{icon:2});
                }
            });
        })
    })

</script>

</body>
<link rel="stylesheet" href="<%=basepath%>/resources/css/skin.css" />
</html>